-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix gizmo near plane clipping bug #20890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IceSentry
approved these changes
Sep 5, 2025
mockersf
approved these changes
Sep 5, 2025
chompaa
approved these changes
Sep 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! fixed the repro
This was referenced Oct 11, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 13, 2025
# Objective - alternative to #21502 - also undoes #20890 - does not regress #19205 - fixes #21489 and #21479 ## Solution the fix i originally made was wrong. the reason it worked was because it failed the conditional and did not clip the lines in some cases where the original bug was exhibited. the condition was correct before, it turns out, but the clipping logic is wrong: an epsilon is added, with a comment saying it is to avoid falsely culling the vertex due to floating point imprecision leaving it just barely in front of the near plane. However, i do not see why an epsilon should be needed here, or why this should be avoided: triangle primitives are regularly intersecting the clipping plane, that is standard order of business. The entire primitive is not discarded if only part of it is clipped, instead only the visible pixels are rasterized. ## Testing - original bug test case by Antony looks right - both grid test cases look right - gizmos examples look right
mate-h
pushed a commit
to mate-h/bevy
that referenced
this pull request
Oct 22, 2025
# Objective - alternative to bevyengine#21502 - also undoes bevyengine#20890 - does not regress bevyengine#19205 - fixes bevyengine#21489 and bevyengine#21479 ## Solution the fix i originally made was wrong. the reason it worked was because it failed the conditional and did not clip the lines in some cases where the original bug was exhibited. the condition was correct before, it turns out, but the clipping logic is wrong: an epsilon is added, with a comment saying it is to avoid falsely culling the vertex due to floating point imprecision leaving it just barely in front of the near plane. However, i do not see why an epsilon should be needed here, or why this should be avoided: triangle primitives are regularly intersecting the clipping plane, that is standard order of business. The entire primitive is not discarded if only part of it is clipped, instead only the visible pixels are rasterized. ## Testing - original bug test case by Antony looks right - both grid test cases look right - gizmos examples look right
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Rendering
Drawing game state to the screen
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Solution
Testing